package com.sanjin.dubbo.serialization.jdk;

import com.sanjin.dubbo.serialization.ObjectOutput;

import java.io.IOException;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.io.Serializable;

/**
 * @author: jiangxch
 * @date: 2021/2/14 上午3:11
 */
public class JdkObjectOutput implements ObjectOutput {
    private ObjectOutputStream oos;
    
    public JdkObjectOutput(OutputStream outputStream) throws IOException {
        oos = new ObjectOutputStream(outputStream);
    }
    
    public void writeObject(Serializable obj) throws IOException {
        oos.writeObject(obj);
    }
    
    public void flushBuffer() throws IOException {
        oos.flush();
    }
}
